package com.enterprise.projectManager.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.sql.Date;
import java.util.List;

@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Project {
    @Id
    private String projectId;
    private String projectName;
    private String projectPlace;
    private Double projectCost;
    private String projectAppendix;
    private String projectState;
    private String projectCurrentPhase;
    private Double projectProgress;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectPlanStarttime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectRealStarttime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectPlanFinishtime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectRealFinishtime;
    private String projectManager;
    private String managerPhone;
    private String projectDescription;
    @JsonIgnore
    @OneToMany(mappedBy = "project",cascade = CascadeType.ALL)
    private List<QualityCheck> qualityChecks=new ArrayList<>();
    @JsonIgnore
    @OneToMany(mappedBy = "project",cascade = CascadeType.ALL)
    private List<Log> logs=new ArrayList<>();
    @JsonIgnore
    @OneToMany(mappedBy = "project",cascade = CascadeType.ALL)
    private List<Problem> problems = new ArrayList<>();
    @JsonIgnore
    @OneToMany(mappedBy = "project",cascade = CascadeType.ALL)
    private List<Contract> contracts =new ArrayList<>();
    @JsonIgnore
    @OneToMany(mappedBy = "project",cascade = CascadeType.ALL)
    private List<Appendix> appendices =new ArrayList<>();
}

